package org.zappee.dannyt.swiz.service
{
	import mx.collections.ArrayCollection;
	import mx.collections.IList;
	import mx.rpc.AsyncToken;
	
	import org.swizframework.util.TestUtil;
	import org.zappee.dannyt.swiz.business.Bug;
	import org.zappee.dannyt.swiz.model.ZappeeModel;

	public class BugServiceDummy implements IBugService
	{
		
		public function BugServiceDummy()
		{
		}

		public function getBugs():AsyncToken
		{
			var bugList:IList = new ArrayCollection();
			
			var bug:Bug = new Bug();
			bug.Id = ZappeeModel.lastBugId ++;
			bug.Title="Can't save new bugs";
			bug.OpenedBy="dan@moov2.com";
			bug.AssignedTo="peter@moov2.com";
			bug.Priority = Bug.PRIORITY_HIGH;
			bugList.addItem(bug);
			
			
			bug = new Bug();
			bug.Id = ZappeeModel.lastBugId ++;
			bug.Title = "Need to cancel bug";
			bug.OpenedBy = "mike@moov2.com";
			bug.AssignedTo = "dan@moov2.com";
			bug.Priority = Bug.PRIORITY_MEDIUM;
			bugList.addItem(bug);
			
			bug = new Bug();
			bug.Id = ZappeeModel.lastBugId ++;
			bug.Title = "Can't view list";
			bug.OpenedBy = "andrea@moov2.com";
			bug.AssignedTo = "peter@moov2.com";
			bug.Priority = Bug.PRIORITY_HIGH;
			bugList.addItem(bug);

			// fake the login result, wait 500ms and show busy cursor
			return TestUtil.mockResult(bugList);
		}
		
		public function saveBug(bug:Bug):AsyncToken
		{
			if(bug.Id < 1)
			{
				bug.Id = ZappeeModel.lastBugId ++;
			}
			return TestUtil.mockResult(bug);
		}
		
	}
}